import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { OutRecordVO, OutRecordForm, OutRecordQuery } from '@/api/credit/outRecord/types';

/**
 * 查询刷卡账单记录列表
 * @param query
 * @returns {*}
 */

export const listOutRecord = (query?: OutRecordQuery): AxiosPromise<OutRecordVO[]> => {
  return request({
    url: '/credit/outRecord/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询刷卡账单记录详细
 * @param id
 */
export const getOutRecord = (id: string | number): AxiosPromise<OutRecordVO> => {
  return request({
    url: '/credit/outRecord/' + id,
    method: 'get'
  });
};

/**
 * 新增刷卡账单记录
 * @param data
 */
export const addOutRecord = (data: OutRecordForm) => {
  return request({
    url: '/credit/outRecord',
    method: 'post',
    data: data
  });
};

/**
 * 修改刷卡账单记录
 * @param data
 */
export const updateOutRecord = (data: OutRecordForm) => {
  return request({
    url: '/credit/outRecord',
    method: 'put',
    data: data
  });
};

/**
 * 删除刷卡账单记录
 * @param id
 */
export const delOutRecord = (id: string | number | Array<string | number>) => {
  return request({
    url: '/credit/outRecord/' + id,
    method: 'delete'
  });
};
